package Common.Entities;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.io.Serializable;
import java.sql.*;


/**
 * This class is for sale entity in db
 * @author Oz Mouchtar
 *
 */
public class Sale implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int saleID;
	private String saleName;
	private String saleDescription;
	private java.sql.Date saleStart;
	private java.sql.Date saleFinish;
	private int templateID;

	

	public Sale(int saleID, String saleName, String saleDescription,
			java.util.Date start, java.util.Date finish, int templateID) {
		this.saleID = saleID;
		this.saleName = saleName;
		this.saleDescription = saleDescription;
		this.saleStart = new java.sql.Date(start.getTime());
		this.saleFinish = new java.sql.Date(finish.getTime());
		this.templateID = templateID;
	}


	public int getSaleID() {
		return saleID;
	}


	public void setSaleID(int saleID) {
		this.saleID = saleID;
	}


	public String getSaleName() {
		return saleName;
	}


	public void setSaleName(String saleName) {
		this.saleName = saleName;
	}


	public String getSaleDescription() {
		return saleDescription;
	}


	public void setSaleDescription(String saleDescription) {
		this.saleDescription = saleDescription;
	}


	public Date getSaleStart() {
		return saleStart;
	}
	
	public String getSaleStrartString() {
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		Calendar cal = Calendar.getInstance();
		cal.setTime(saleStart);
		return dateFormat.format(cal.getTime());
	}


	public void setSaleStart(java.sql.Date saleStart) {
		this.saleStart = saleStart;
	}


	public Date getSaleFinish() {
		return saleFinish;
	}

	public String getSaleFinishString() {
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		Calendar cal = Calendar.getInstance();
		cal.setTime(saleFinish);
		return dateFormat.format(cal.getTime());
	}
	
	public void setSaleFinish(java.sql.Date saleFinish) {
		this.saleFinish = saleFinish;
	}


	public int getTemplateID() {
		return templateID;
	}


	public void setTemplateID(int templateID) {
		this.templateID = templateID;
	}

}
